<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Drag and Drop File Upload</title>
</head>
<body>
  <textarea id="input1" rows="5" cols="50">{"name": "John", "age": 30}</textarea>
  <textarea id="input2" rows="5" cols="50">{"name": "Jane", "age": 25}</textarea>
  <textarea id="output" rows="5" cols="50"></textarea>
  <button id="parseButton">Parse JSON</button>
  <div id="dropzone" style="height: 200px;">Drop files here</div>
  <img id="img" src="" alt="image">
  <script>
    const input1 = document.getElementById('input1');
    const input2 = document.getElementById('input2');
    const output = document.getElementById('output');
    const parseButton = document.getElementById('parseButton');
    const img = document.getElementById('img');
    let data1 = undefined;
    let data2 = undefined;
    let missing_keys = [];
    let dropzone = document.getElementById('dropzone');

    input2.value = `{
    "card/Aquila Favonia": "cardface/Assist_Location_FavoniusChurch.png",
    "card/Thundering Poise": "cardface/Modify_Artifact_Thunder.png",
    "card/Thunder Summoner's Crown": "cardface/Modify_Artifact_Thunder.png",
    "card/Thundering Fury": "cardface/Modify_Artifact_Thunder.png",
    "card/Liyue Harbor Wharf": "cardface/Assist_Location_LiyueHarbor.png",
    "card/Favonius Cathedral": "cardface/Assist_Location_FavoniusChurch.png",
    "card/Grand Narukami Shrine": "cardface/Modify_Weapon_Narukami.png",
    "card/Gandharva Ville": "cardface/Assist_Location_Gandharva.png",
    "card/Paimon": "cardface/Assist_NPC_Paimon.png",
    "card/Katheryne": "cardface/Assist_NPC_Katheryne.png",
    "card/Timaeus": "cardface/Assist_NPC_Timaeus.png",
    "card/Wagner": "cardface/Assist_NPC_Wagner.png",
    "card/Xudong": "cardface/Assist_NPC_Xudong.png",
    "card/Parametric Transformer": "cardface/Assist_Prop_ParametricTransformer.png",
    "card/Thunder and Eternity": "cardface/Modify_Artifact_Thunder.png",
    "card/Jueyun Guoba": "cardface/Event_Food_Jueyunguoba.png",
    "card/Naganohara Meteor Swarm": "cardface/Assist_Prop_ParametricTransformer.png",
    "card/Thundering Penance": "cardface/Modify_Artifact_Thunder.png",
    "summon/Talisman Spirit": "cardface/Summon_LargeWindSpirit.png",
    "summon/Oceanic Mimic: Raptor": "cardface/Summon_Raptor.png",
    "summon/Guoba": "cardface/Summon_Guoba.png",
    "summon/Large Wind Spirit": "cardface/Summon_LargeWindSpirit.png",
    "summon/Dandelion Field": "cardface/Summon_DandelionBreeze.png",
    "character/Ganyu": "cardface/Char_Avatar_Ganyu.png",
    "character/Kaeya": "cardface/Char_Avatar_Kaeya.png",
    "character/Chongyun": "cardface/Char_Avatar_Chongyun.png",
    "character/Shenhe": "cardface/Char_Avatar_Shenhe.png",
    "character/Barbara": "cardface/Char_Avatar_Barbara.png",
    "character/Xingqiu": "cardface/Char_Avatar_Xingqiu.png",
    "character/Tartaglia": "cardface/Char_Avatar_Tartaglia.png",
    "character/Candace": "cardface/Char_Avatar_Candace.png",
    "character/Mirror Maiden": "cardface/Char_Monster_Maidenwater.png",
    "character/Diluc": "cardface/Char_Avatar_Diluc.png",
    "character/Xiangling": "cardface/Char_Avatar_Xiangling.png",
    "character/Bennett": "cardface/Char_Avatar_Bennett.png",
    "character/Yoimiya": "cardface/Char_Avatar_Yoimiya.png",
    "character/Hu Tao": "cardface/Char_Avatar_Hutao.png",
    "character/Yanfei": "cardface/Char_Avatar_Feiyan.png",
    "character/Dehya": "cardface/Char_Avatar_Dehya.png",
    "character/Fischl": "cardface/Char_Avatar_Fischl.png",
    "character/Razor": "cardface/Char_Avatar_Razor.png",
    "character/Keqing": "cardface/Char_Avatar_Keqing.png",
    "character/Beidou": "cardface/Char_Avatar_Beidou.png",
    "character/Sucrose": "cardface/Char_Avatar_Sucrose.png",
    "character/Venti": "cardface/Char_Avatar_Venti.png",
    "character/Kaedehara Kazuha": "cardface/Char_Avatar_Kazuha.png",
    "character/Wanderer": "cardface/Char_Avatar_Wanderer.png",
    "character/Ningguang": "cardface/Char_Avatar_Ningguang.png",
    "character/Zhongli": "cardface/Char_Avatar_Zhongli.png",
    "character/Albedo": "cardface/Char_Avatar_Albedo.png",
    "character/Collei": "cardface/Char_Avatar_Collei.png",
    "character/Tighnari": "cardface/Char_Avatar_Tighnari.png",
    "character/Nahida": "cardface/Char_Avatar_Nahida.png",
    "character/Yaoyao": "cardface/Char_Avatar_Yaoyao.png",
    "character_status/Stealth": "",
    "character_status/Explosive Spark": "",
    "character_status/Niwabi Enshou": "",
    "character_status/Brilliance": "",
    "character_status/Scarlet Seal": "",
    "character_status/Paramita Papilio": "",
    "character_status/Blood Blossom": "",
    "character_status/Pyro Elemental Infusion": "",
    "character_status/Fiery Rebirth": "",
    "character_status/Aegis of Abyssal Flame": "",
    "character_status/Incineration Drive": "",
    "character_status/Seed of Skandha": "",
    "character_status/Vijnana Suffusion": "",
    "character_status/Radical Vitality": "",
    "character_status/Sweeping Time": "",
    "character_status/Raging Oni King": "",
    "character_status/Superlative Superstrength": "",
    "character_status/Stonehide": "",
    "character_status/Petrification": "",
    "character_status/Electro Elemental Infusion": "",
    "character_status/Rock-Paper-Scissors Combo: Scissors": "",
    "character_status/Rock-Paper-Scissors Combo: Paper": "",
    "character_status/Electro Crystal Core": "",
    "character_status/Chakra Desiderata": "",
    "character_status/The Shrine's Sacred Shade": "",
    "character_status/The Wolf Within": "",
    "character_status/Tidecaller: Surf Embrace": "",
    "character_status/Crowfeather Cover": "",
    "character_status/Pactsworn Pathclearer": "",
    "character_status/Conductive": "",
    "character_status/Midare Ranzan: New": "",
    "character_status/Midare Ranzan": "",
    "character_status/Midare Ranzan: Pyro": "",
    "character_status/Midare Ranzan: Hydro": "",
    "character_status/Midare Ranzan: Cryo": "",
    "character_status/Midare Ranzan: Electro": "",
    "character_status/Yaksha's Mask": "",
    "character_status/Windfavored": "",
    "character_status/Riptide": "",
    "character_status/Ranged Stance": "",
    "character_status/Melee Stance": "",
    "character_status/Ceremonial Garment": "",
    "character_status/Heron Shield": "",
    "character_status/Refraction": "",
    "character_status/Takimeguri Kanka": "",
    "character_status/Grimheart": "",
    "character_status/Cryo Elemental Infusion": "",
    "character_status/Frozen": "",
    "character_status/Satiated": "",
    "character_status/Jueyun Guoba": "",
    "character_status/Adeptus' Temptation": "",
    "character_status/Lotus Flower Crisp": "",
    "character_status/Northern Smoked Chicken": "",
    "character_status/Mushroom Pizza": "",
    "character_status/Minty Meat Rolls": "",
    "character_status/Sashimi Platter": "",
    "character_status/Tandoori Roast Chicken": "",
    "character_status/Butter Crab": "",
    "character_status/Unmovable Mountain": "",
    "character_status/Vermillion Hereafter": "",
    "character_status/Lithic Spear": "",
    "character_status/King's Squire": "",
    "character_status/Moonpiercer": "",
    "character_status/Heavy Strike": "",
    "character_status/Elemental Resonance: Shattering Ice": "",
    "character_status/Elemental Resonance: Fervent Flames": "",
    "team_status/Catalyzing Field": "",
    "team_status/Dendro Core": "",
    "team_status/Crystallize": "",
    "team_status/Illusory Bubble": "",
    "team_status/Rainbow Bladework": "",
    "team_status/Rain Sword": "",
    "team_status/Prayer of the Crimson Crown": "",
    "team_status/Shrine of Maya": "",
    "team_status/Floral Sidewinder": "",
    "team_status/Adeptal Legacy": "",
    "team_status/Full Plate": "",
    "team_status/Jade Screen": "",
    "team_status/Jade Shield": "",
    "team_status/Stormzone": "",
    "team_status/Winds of Harmony": "",
    "team_status/Poetics of Fuubutsu: Pyro": "",
    "team_status/Poetics of Fuubutsu: Hydro": "",
    "team_status/Poetics of Fuubutsu: Electro": "",
    "team_status/Poetics of Fuubutsu: Cryo": "",
    "team_status/Sparks 'n' Splash": "",
    "team_status/Inspiration Field": "",
    "team_status/Aurous Blaze": "",
    "team_status/Pyronado": "",
    "team_status/Icicle": "",
    "team_status/Icy Quill": "",
    "team_status/Chonghua's Frost Field": "",
    "team_status/Ice Lotus": "",
    "team_status/Fortune-Preserving Talisman": "",
    "team_status/Cat-Claw Shield": "",
    "team_status/Flowing Cicin Shield": "",
    "team_status/Tenko Thunderbolts": "",
    "team_status/Thunderbeast's Targe": "",
    "team_status/Fresh Wind of Freedom": "",
    "team_status/Changing Shifts": "",
    "team_status/I Haven't Lost Yet!": "",
    "team_status/Leave It to Me!": "",
    "team_status/Elemental Resonance: Enduring Rock": "",
    "team_status/Where Is the Unseen Razor?": "",
    "team_status/Elemental Resonance: Sprawling Greenery": "",
    "team_status/Revive on cooldown": "",
    "team_status/Stone and Contracts": "",
    "team_status/Ancient Courtyard": "",
    "team_status/Fatui Ambusher: Cryo Cicin Mage": "",
    "team_status/Fatui Ambusher: Mirror Maiden": "",
    "team_status/Fatui Ambusher: Pyroslinger Bracer": "",
    "team_status/Fatui Ambusher: Electrohammer Vanguard": "",
    "team_status/Rhythm of the Great Dream": "",
    "team_status/When the Crane Returned": "",
    "team_status/Wind and Freedom": "",
    "team_status/Pankration!": "",
    "team_status/Rebellious Shield": "",
    "team_status/Millennial Movement: Farewell Song": "",
    "character/AnemoMobMage": "cardface/Assist_NPC_Huasanli.png",
    "character/DendroMobMage": "cardface/Assist_NPC_Huasanli.png",
    "character/GeoMobMage": "cardface/Assist_NPC_Huasanli.png",
    "character/ElectroMobMage": "cardface/Assist_NPC_Huasanli.png",
    "character/PyroMobMage": "cardface/Assist_NPC_Huasanli.png",
    "character/HydroMobMage": "cardface/Assist_NPC_Huasanli.png",
    "character/CryoMobMage": "cardface/Assist_NPC_Huasanli.png",
    "character/PhysicalMob": "cardface/Assist_NPC_Changjiuye.png",
    "character/AnemoMob": "cardface/Assist_NPC_Changjiuye.png",
    "character/DendroMob": "cardface/Assist_NPC_Changjiuye.png",
    "character/GeoMob": "cardface/Assist_NPC_Changjiuye.png",
    "character/ElectroMob": "cardface/Assist_NPC_Changjiuye.png",
    "character/PyroMob": "cardface/Assist_NPC_Changjiuye.png",
    "character/HydroMob": "cardface/Assist_NPC_Changjiuye.png",
    "character/CryoMob": "cardface/Assist_NPC_Changjiuye.png"
}`;
    input1.value = `{"card/Magic Guide": null, "card/Raven Bow": null, "card/Traveler's Handy Sword": null, "card/White Iron Greatsword": null, "card/White Tassel": null, "card/Sacrificial Fragments": null, "card/Sacrificial Greatsword": null, "card/Sacrificial Sword": null, "card/Sacrificial Bow": null, "card/A Thousand Floating Dreams": null, "card/Amos' Bow": null, "card/Elegy for the End": null, "card/Wolf's Gravestone": null, "card/The Bell": null, "card/Lithic Spear": null, "card/Vortex Vanquisher": null, "card/Engulfing Lightning": null, "card/Aquila Favonia": null, "card/Skyward Atlas": null, "card/Skyward Harp": null, "card/Skyward Pride": null, "card/Skyward Spine": null, "card/Skyward Blade": null, "card/Favonius Sword": null, "card/Fruit of Fulfillment": null, "card/King's Squire": null, "card/Moonpiercer": null, "card/Adventurer's Bandana": null, "card/Lucky Dog's Silver Circlet": null, "card/Traveling Doctor's Handkerchief": null, "card/Gambler's Earrings": null, "card/Instructor's Cap": null, "card/Exile's Circlet": null, "card/Ornate Kabuto": null, "card/Emblem of Severed Fate": null, "card/General's Ancient Helm": null, "card/Tenacity of the Millelith": null, "card/Thundering Poise": null, "card/Vermillion Hereafter": null, "card/Capricious Visage": null, "card/Shimenawa's Reminiscence": null, "card/Crown of Watatsumi": null, "card/Broken Rime's Echo": null, "card/Laurel Coronet": null, "card/Mask of Solitude Basalt": null, "card/Thunder Summoner's Crown": null, "card/Viridescent Venerer's Diadem": null, "card/Wine-Stained Tricorne": null, "card/Witch's Scorching Hat": null, "card/Blizzard Strayer": null, "card/Deepwood Memories": null, "card/Archaic Petra": null, "card/Thundering Fury": null, "card/Viridescent Venerer": null, "card/Heart of Depth": null, "card/Crimson Witch of Flames": null, "card/Liyue Harbor Wharf": null, "card/Knights of Favonius Library": null, "card/Jade Chamber": null, "card/Dawn Winery": null, "card/Wangshu Inn": null, "card/Favonius Cathedral": null, "card/Tenshukaku": null, "card/Grand Narukami Shrine": null, "card/Sangonomiya Shrine": null, "card/Sumeru City": null, "card/Vanarana": null, "card/Chinju Forest": null, "card/Golden House": null, "card/Gandharva Ville": null, "card/Paimon": null, "card/Katheryne": null, "card/Timaeus": null, "card/Wagner": null, "card/Chef Mao": null, "card/Tubby": null, "card/Timmie": null, "card/Liben": null, "card/Chang the Ninth": null, "card/Ellin": null, "card/Iron Tongue Tian": null, "card/Liu Su": null, "card/Hanachirusato": null, "card/Kid Kujirai": null, "card/Xudong": null, "card/Dunyarzad": null, "card/Rana": null, "card/Master Zhang": null, "card/Setaria": null, "card/Yayoi Nanatsuki": null, "card/Parametric Transformer": null, "card/NRE": null, "card/Red Feather Fan": null, "card/Treasure-Seeking Seelie": null, "card/Ancient Courtyard": null, "card/Covenant of Rock": null, "card/Joyous Celebration": null, "card/Fresh Wind of Freedom": null, "card/Elemental Resonance: Woven Flames": null, "card/Elemental Resonance: Woven Ice": null, "card/Elemental Resonance: Woven Stone": null, "card/Elemental Resonance: Woven Thunder": null, "card/Elemental Resonance: Woven Waters": null, "card/Elemental Resonance: Woven Weeds": null, "card/Elemental Resonance: Woven Winds": null, "card/Elemental Resonance: Shattering Ice": null, "card/Elemental Resonance: Soothing Water": null, "card/Elemental Resonance: Fervent Flames": null, "card/Elemental Resonance: High Voltage": null, "card/Elemental Resonance: Impetuous Winds": null, "card/Elemental Resonance: Enduring Rock": null, "card/Elemental Resonance: Sprawling Greenery": null, "card/Wind and Freedom": null, "card/Stone and Contracts": null, "card/Thunder and Eternity": null, "card/Nature and Wisdom": null, "card/Abyssal Summons": null, "card/Fatui Conspiracy": null, "card/The Bestest Travel Companion!": null, "card/Changing Shifts": null, "card/Toss-Up": null, "card/Strategize": null, "card/I Haven't Lost Yet!": null, "card/Leave It to Me!": null, "card/When the Crane Returned": null, "card/Starsigns": null, "card/Calx's Arts": null, "card/Master of Weaponry": null, "card/Blessing of the Divine Relic's Installation": null, "card/Quick Knit": null, "card/Send Off": null, "card/Guardian's Oath": null, "card/Plunging Strike": null, "card/Heavy Strike": null, "card/The Legend of Vennessa": null, "card/Friendship Eternal": null, "card/Rhythm of the Great Dream": null, "card/Where Is the Unseen Razor?": null, "card/Pankration!": null, "card/Jueyun Guoba": null, "card/Adeptus' Temptation": null, "card/Lotus Flower Crisp": null, "card/Northern Smoked Chicken": null, "card/Sweet Madame": null, "card/Mondstadt Hash Brown": null, "card/Mushroom Pizza": null, "card/Minty Meat Rolls": null, "card/Teyvat Fried Egg": null, "card/Sashimi Platter": null, "card/Tandoori Roast Chicken": null, "card/Butter Crab": null, "card/Undivided Heart": null, "card/Shaken, Not Purred": null, "card/Cold-Blooded Strike": null, "card/Steady Breathing": null, "card/Kanten Senmyou Blessing": null, "card/Wellspring of War-Lust": null, "card/Mystical Abandon": null, "card/Rite of Resurrection": null, "card/Cicin's Cold Glare": null, "card/Glorious Season": null, "card/The Scent Remained": null, "card/Prophecy of Submersion": null, "card/Abyssal Mayhem: Hydrospout": null, "card/Tamakushi Casket": null, "card/Kyouka Fuushi": null, "card/The Overflow": null, "card/Streaming Surge": null, "card/Mirror Cage": null, "card/Flowing Flame": null, "card/Crossfire": null, "card/Grand Expectation": null, "card/Bunny Triggered": null, "card/Naganohara Meteor Swarm": null, "card/Pounding Surprise": null, "card/Sanguine Rouge": null, "card/Right of Final Interpretation": null, "card/Stalwart and True": null, "card/Paid in Full": null, "card/Embers Rekindled": null, "card/Stellar Predator": null, "card/Awakening": null, "card/Thundering Penance": null, "card/Featherfall Judgment": null, "card/Lightning Storm": null, "card/Sin of Pride": null, "card/Wishes Unnumbered": null, "card/The Shrine's Sacred Shade": null, "card/Pulsating Witch": null, "card/Absorbing Prism": null, "card/Lightning Stiletto": null, "card/Chaotic Entropy": null, "card/Lands of Dandelion": null, "card/Embrace of Winds": null, "card/Conqueror of Evil: Guardian Yaksha": null, "card/Poetics of Fuubutsu": null, "card/Gales of Reverie": null, "card/Transcendent Automaton": null, "card/Strategic Reserve": null, "card/I Got Your Back": null, "card/Dominance of Earth": null, "card/Descent of Divinity": null, "card/Arataki Ichiban": null, "card/Stonehide Reforged": null, "card/Floral Sidewinder": null, "card/Keen Sight": null, "card/The Seed of Stored Knowledge": null, "card/Beneficent": null, "card/Proliferating Spores": null, "summon/Burning Flame": null, "summon/Cryo Hilichurl Shooter": null, "summon/Electro Hilichurl Shooter": null, "summon/Hilichurl Berserker": null, "summon/Hydro Samachurl": null, "summon/Sacred Cryo Pearl": null, "summon/Drunken Mist": null, "summon/Frostflake Seki no To": null, "summon/Lightfall Sword": null, "summon/Talisman Spirit": null, "summon/Herald of Frost": null, "summon/Cryo Cicins": null, "summon/Melody Loop": null, "summon/Reflection": null, "summon/Bake-Kurage": null, "summon/Garden of Purity": null, "summon/Oceanic Mimic: Frog": null, "summon/Oceanic Mimic: Squirrel": null, "summon/Oceanic Mimic: Raptor": null, "summon/Guoba": null, "summon/Baron Bunny": null, "summon/Fiery Sanctum Field": null, "summon/Darkfire Furnace": null, "summon/Oz": null, "summon/Tengu Juurai: Ambush": null, "summon/Tengu Juurai: Stormcluster": null, "summon/Eye of Stormy Judgment": null, "summon/Sesshou Sakura": null, "summon/Lightning Rose": null, "summon/Chains of Warding Thunder": null, "summon/Large Wind Spirit": null, "summon/Dandelion Field": null, "summon/Stormeye": null, "summon/Autumn Whirlwind": null, "summon/Shadowsword: Galloping Frost": null, "summon/Shadowsword: Lone Gale": null, "summon/Stone Stele": null, "summon/Solar Isotoma": null, "summon/Ushi": null, "summon/Cuilein-Anbar": null, "summon/Clusterbloom Arrow": null, "summon/Yuegui: Throwing Mode": null, "character/Ganyu": null, "character/Diona": null, "character/Kaeya": null, "character/Chongyun": null, "character/Kamisato Ayaka": null, "character/Eula": null, "character/Shenhe": null, "character/Qiqi": null, "character/Fatui Cryo Cicin Mage": null, "character/Barbara": null, "character/Xingqiu": null, "character/Mona": null, "character/Tartaglia": null, "character/Sangonomiya Kokomi": null, "character/Kamisato Ayato": null, "character/Candace": null, "character/Rhodeia of Loch": null, "character/Mirror Maiden": null, "character/Diluc": null, "character/Xiangling": null, "character/Bennett": null, "character/Amber": null, "character/Yoimiya": null, "character/Klee": null, "character/Hu Tao": null, "character/Yanfei": null, "character/Dehya": null, "character/Fatui Pyro Agent": null, "character/Abyss Lector: Fathomless Flames": null, "character/Fischl": null, "character/Razor": null, "character/Keqing": null, "character/Cyno": null, "character/Beidou": null, "character/Kujou Sara": null, "character/Raiden Shogun": null, "character/Yae Miko": null, "character/Lisa": null, "character/Electro Hypostasis": null, "character/Sucrose": null, "character/Jean": null, "character/Venti": null, "character/Xiao": null, "character/Kaedehara Kazuha": null, "character/Wanderer": null, "character/Maguu Kenki": null, "character/Ningguang": null, "character/Noelle": null, "character/Zhongli": null, "character/Albedo": null, "character/Arataki Itto": null, "character/Stonehide Lawachurl": null, "character/Collei": null, "character/Tighnari": null, "character/Nahida": null, "character/Yaoyao": null, "character/Jadeplume Terrorshroom": null, "character/CryoMob": null, "character/HydroMob": null, "character/PyroMob": null, "character/ElectroMob": null, "character/GeoMob": null, "character/DendroMob": null, "character/AnemoMob": null, "character/PhysicalMob": null, "character/CryoMobMage": null, "character/HydroMobMage": null, "character/PyroMobMage": null, "character/ElectroMobMage": null, "character/GeoMobMage": null, "character/DendroMobMage": null, "character/AnemoMobMage": null, "character_status/Stealth": "BARRIER", "character_status/Explosive Spark": "ATK_UP", "character_status/Niwabi Enshou": "ATK_UP_FIRE", "character_status/Brilliance": "OTHERS", "character_status/Scarlet Seal": "ATK_UP", "character_status/Paramita Papilio": "ATK_UP", "character_status/Blood Blossom": "DOT", "character_status/Pyro Elemental Infusion": "ELEMENT_ENCHANT_FIRE", "character_status/Fiery Rebirth": "REVIVE", "character_status/Aegis of Abyssal Flame": "SHIELD", "character_status/Incineration Drive": "SPECIAL", "character_status/Seed of Skandha": "OTHERS", "character_status/Vijnana Suffusion": "ELEMENT_ENCHANT_GRASS", "character_status/Radical Vitality": "OTHERS", "character_status/Sweeping Time": "OTHERS", "character_status/Raging Oni King": "OTHERS", "character_status/Superlative Superstrength": "ATK_UP_ROCK", "character_status/Stonehide": "BARRIER", "character_status/Petrification": "OTHERS", "character_status/Electro Elemental Infusion": "ELEMENT_ENCHANT_ELEC", "character_status/Rock-Paper-Scissors Combo: Scissors": "SPECIAL", "character_status/Rock-Paper-Scissors Combo: Paper": "SPECIAL", "character_status/Electro Crystal Core": "REVIVE", "character_status/Chakra Desiderata": "OTHERS", "character_status/The Shrine's Sacred Shade": "SPECIAL", "character_status/The Wolf Within": "OTHERS", "character_status/Tidecaller: Surf Embrace": "SHIELD", "character_status/Crowfeather Cover": "ATK_UP", "character_status/Pactsworn Pathclearer": "OTHERS", "character_status/Conductive": "DEBUFF", "character_status/Midare Ranzan: New": "SPECIAL", "character_status/Midare Ranzan": "ELEMENT_ENCHANT_WIND", "character_status/Midare Ranzan: Pyro": "ELEMENT_ENCHANT_FIRE", "character_status/Midare Ranzan: Hydro": "ELEMENT_ENCHANT_WATER", "character_status/Midare Ranzan: Cryo": "ELEMENT_ENCHANT_ICE", "character_status/Midare Ranzan: Electro": "ELEMENT_ENCHANT_ELEC", "character_status/Yaksha's Mask": "OTHERS", "character_status/Windfavored": "ATK_UP", "character_status/Riptide": "OTHERS", "character_status/Ranged Stance": "OTHERS", "character_status/Melee Stance": "OTHERS", "character_status/Ceremonial Garment": "OTHERS", "character_status/Heron Shield": "SHIELD", "character_status/Refraction": "DEBUFF", "character_status/Takimeguri Kanka": "ATK_UP_WATER", "character_status/Grimheart": "ATK_UP_ICE", "character_status/Cryo Elemental Infusion": "ELEMENT_ENCHANT_ICE", "character_status/Frozen": "FROZEN", "character_status/Satiated": "FOOD", "character_status/Jueyun Guoba": "ATK_UP", "character_status/Adeptus' Temptation": "ATK_UP", "character_status/Lotus Flower Crisp": "BARRIER", "character_status/Northern Smoked Chicken": "BUFF", "character_status/Mushroom Pizza": "HEAL", "character_status/Minty Meat Rolls": "BUFF", "character_status/Sashimi Platter": "ATK_UP", "character_status/Tandoori Roast Chicken": "ATK_UP", "character_status/Butter Crab": "BARRIER", "character_status/Unmovable Mountain": "SHIELD", "character_status/Vermillion Hereafter": "ATK_UP", "character_status/Lithic Spear": "SHIELD", "character_status/King's Squire": "BUFF", "character_status/Moonpiercer": "BUFF", "character_status/Heavy Strike": "ATK_UP", "character_status/Elemental Resonance: Shattering Ice": "ATK_UP", "character_status/Elemental Resonance: Fervent Flames": "ATK_UP", "team_status/Catalyzing Field": "OTHERS", "team_status/Dendro Core": "OTHERS", "team_status/Crystallize": "SHIELD", "team_status/Illusory Bubble": "OTHERS", "team_status/Rainbow Bladework": "OTHERS", "team_status/Rain Sword": "BARRIER", "team_status/Prayer of the Crimson Crown": "OTHERS", "team_status/Shrine of Maya": "OTHERS", "team_status/Floral Sidewinder": "ATK_SELF", "team_status/Adeptal Legacy": "OTHERS", "team_status/Full Plate": "SHIELD", "team_status/Jade Screen": "BARRIER", "team_status/Jade Shield": "SHIELD", "team_status/Stormzone": "SPECIAL", "team_status/Winds of Harmony": "SPECIAL", "team_status/Poetics of Fuubutsu: Pyro": "ATK_UP_FIRE", "team_status/Poetics of Fuubutsu: Hydro": "ATK_UP_WATER", "team_status/Poetics of Fuubutsu: Electro": "ATK_UP_ELEC", "team_status/Poetics of Fuubutsu: Cryo": "ATK_UP_ICE", "team_status/Sparks 'n' Splash": "OTHERS", "team_status/Inspiration Field": "OTHERS", "team_status/Aurous Blaze": "OTHERS", "team_status/Pyronado": "OTHERS", "team_status/Icicle": "OTHERS", "team_status/Icy Quill": "ATK_UP_ICE", "team_status/Chonghua's Frost Field": "ELEMENT_ENCHANT_ICE", "team_status/Ice Lotus": "BARRIER", "team_status/Fortune-Preserving Talisman": "OTHERS", "team_status/Cat-Claw Shield": "SHIELD", "team_status/Flowing Cicin Shield": "SHIELD", "team_status/Tenko Thunderbolts": "OTHERS", "team_status/Thunderbeast's Targe": "OTHERS", "team_status/Fresh Wind of Freedom": "BUFF", "team_status/Changing Shifts": "SPECIAL", "team_status/I Haven't Lost Yet!": "DEBUFF", "team_status/Leave It to Me!": "SPECIAL", "team_status/Elemental Resonance: Enduring Rock": "BUFF", "team_status/Where Is the Unseen Razor?": "BUFF", "team_status/Elemental Resonance: Sprawling Greenery": "ATK_UP", "team_status/Revive on cooldown": "FOOD", "team_status/Stone and Contracts": "BUFF", "team_status/Ancient Courtyard": "BUFF", "team_status/Fatui Ambusher: Cryo Cicin Mage": "OTHERS", "team_status/Fatui Ambusher: Mirror Maiden": "OTHERS", "team_status/Fatui Ambusher: Pyroslinger Bracer": "OTHERS", "team_status/Fatui Ambusher: Electrohammer Vanguard": "OTHERS", "team_status/Rhythm of the Great Dream": "BUFF", "team_status/When the Crane Returned": "SPECIAL", "team_status/Wind and Freedom": "BUFF", "team_status/Pankration!": "SPECIAL", "team_status/Rebellious Shield": "SHIELD", "team_status/Millennial Movement: Farewell Song": "ATK_UP"}`;


    function updateNext() {
      output.value = JSON.stringify(data2);
      if (missing_keys.length == 0) {
        alert('done')
        return;
      }
      let key = missing_keys.pop();
      let imgpath = 'images/' + key.split('/')[1] + '.png';
      img.src = imgpath.replace(/[:]/g, '_');
      dropzone.innerText = key;
    }

    parseButton.addEventListener('click', function() {
      data1 = JSON.parse(input1.value);
      data2 = JSON.parse(input2.value);
      // extract missing keys
      for (let key in data1)
        if (!(key in data2))
          missing_keys.push(key);
      console.log(missing_keys)
      updateNext();
    });

    dropzone.addEventListener('dragover', function(event) {
      event.preventDefault();
      dropzone.style.backgroundColor = '#ccc';
    });

    dropzone.addEventListener('dragleave', function(event) {
      event.preventDefault();
      dropzone.style.backgroundColor = '#fff';
    });

    dropzone.addEventListener('drop', function(event) {
      event.preventDefault();
      dropzone.style.backgroundColor = '#fff';
      let file = event.dataTransfer.files[0];
      let key = dropzone.innerText;
      let type = key.split('/')[0];
      let folder = 'cardface'
      if (type == 'team_status' || type == 'character_status')
        folder = 'status'
      console.log('File name:', file.name);
      data2[key] = folder + '/' + file.name;
      updateNext();
    });
  </script>
</body>
</html>
